var notice = new Vue({
    el:'#notice',
    //初始化数据类型
    data:{
        //公告综合
        noticeList:[],
        //每页显示条数
        pagesize:'10',
        //当前页
        currentPage:'1',
    },
    //提交时间的方法
    methods: {
        //每页显示条数
        handleSizeChange:function(size){
            var _this = this;
            _this.pagesize = size;

        },
        //当前页
        handleCurrentChange:function(currentPage){
            var _this = this;
            _this.currentPage = currentPage;
        },
        //时间格式化
        dateFormat:function(row,column) {
            var date = row[column.property];
            if (date == undefined) {

            }
            return moment(date).format("YYYY-MM-DD");
        },
        //删除公告
        deleteNotice: function (index,notice) {
            debugger
            var _this = this;
            $.post("/home/notice/deleteNotice", {"notice": JSON.stringify(notice[(_this.currentPage-1)*_this.pagesize+index])}, function (data) {
                if(data.data.notice==1){
                    _this.$message({
                        message: '恭喜你，公告信息已删除！',
                        type: 'success'
                    });
                }else{
                    _this.$message({
                        message: '警告哦，公告信息删除失败！',
                        type: 'warning'
                    });
                }
            });
            notice.splice((_this.currentPage-1)*_this.pagesize+index,1);

        },

        //新增按钮
        add: function () {
            var _this = this;
            $("#wrap-left").load("http://"+window.location.host+"/person/noticeAddUpdate.html",function(){
                noticeAddUpdate.title="新增公告信息";
                noticeAddUpdate.button="增加";
            });
        },
        //下载按钮
        Dowload:function(notice){
            var _this = this;
            $.get("/home/notice/ExcelTest",{"notice":JSON.stringify(notice)}, function(data){

            });
        },

        //修改按钮
        updateNotice: function (notice) {
            var _this = this;
            debugger
            $("#wrap-left").load("http://"+window.location.host+"/person/noticeAddUpdate.html",function(){
                noticeAddUpdate.details   =  notice.details;
                noticeAddUpdate.startTime =  notice.startTime;
                noticeAddUpdate.overTime  =  notice.overTime;
                noticeAddUpdate.noticeUnit = notice ;
                noticeAddUpdate.title="修改公告信息";
                noticeAddUpdate.button="修改";


            });
        },
        //查看详情
        detailNotice:function(row){
            var _this = this;
            $("#wrap-left").load("http://"+window.location.host+"/home/noticeInfo.html",function(){
                $("#header").css("display","none");
                $("#Footered").css("display","none");
                noticeInfo.noticeVo = row;
            });
        },
    },
    //页面加载完成后执行此方法
    created :function(){
        debugger
        var _this= this;

    },
});